// 封装轮播图业务相关的代码

import { getBannerAPI } from "@/apis/home"
import { onMounted, ref } from "vue"

export function useBanner() {
  // 创建banner列表
  const bannerList = ref([])
  // 获取banner
  const getBanner = async () => {
    const res = await getBannerAPI({ distributionSite: '2' })
    bannerList.value = res.result
  }
  // 页面挂载时触发
  onMounted(() => {
    getBanner()
  })

  return {
    bannerList
  }
}
